﻿using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.SystemSettings.Dto;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.SystemSettings
{
    /// <summary>
    /// 流程催办配置
    /// </summary>
    [ApiController]
    [Route("api/FlowUrgingConfiguration")]
    public class FlowUrgingConfigurationController : BPMReportPlatformController
    {
        private readonly IFlowUrgingConfigurationAppService _configurationAppService;
        public FlowUrgingConfigurationController(IFlowUrgingConfigurationAppService configurationAppService)
        {
            _configurationAppService = configurationAppService;
        }

        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("GetAllAsync")]
        public async Task<PagedResultDto<GetFlowUrgingConfigurationOutput>> GetAllAsync([FromBody] GetFlowUrgingConfigurationInput input)
        {
            return await _configurationAppService.GetAllAsync(input);
        }

        /// <summary>
        /// 保存审批配置
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("SaveAsync")]
        public async Task SaveAsync([FromBody] SaveFlowUrgingConfigurationInput input)
        {
            await _configurationAppService.SaveAsync(input);
        }

        /// <summary>
        /// 删除审批配置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        [Route("DeleteAsync")]
        public async Task DeleteAsync([FromQuery] int id)
        {
            await _configurationAppService.DeleteAsync(id);
        }
    }
}
